var express = require('express');
var router = express.Router();
const { chexiModel, typeModel, carModel } = require("../model/db")

/* GET home page. */
router.post('/add', async (req, res) => {
  await carModel.create(req.body)
  res.send({
    code: 200
  })
});

router.get('/getcx', async (req, res) => {
  const list = await chexiModel.find()
  res.send({
    list
  })
});

router.get('/gettype', async (req, res) => {
  const list = await typeModel.find()
  res.send({
    list
  })
});

router.get('/getcar', async (req, res) => {
  const list = await carModel.find()
  res.send({
    list
  })
});

router.post('/', async (req, res) => {

});

router.post('/', async (req, res) => {

});

router.post('/', async (req, res) => {

});

module.exports = router;
